home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
ELECTRON
/
1009.ZIP
/
HAM2.ARC
/
NGRBEARG.BAS
< prev
next >
Wrap
BASIC Source File
|
1986-05-23
|
965b
|
28 lines
10 REM GM4ANB 5.14 POINT TO POINT DISTANCE AND BEARING FROM NGRs
20 PI=3.14159265#:DR=PI/180
30 DEF FNA(X)=INT(X*10+.5)/10
40 CLS
100 PRINT: INPUT"HOME NGR";G$
110 GOSUB 1000
120 T1=(N1+5549.73)/6372.37
130 T2=2*ATN(EXP((E1-400)/6389.32))
140 GN=ATN(-COS(T2)*SIN(T1)/COS(T1))
150 HN=N1: HE=E1
200 PRINT: INPUT "DX NGR";G$
210 GOSUB 1000
220 DE=ABS(E1-HE): DN=ABS(N1-HN)
230 AZ=ATN(DE/DN)
240 IF E1<HE THEN AZ=-AZ
250 IF N1<HN THEN AZ=PI-AZ
260 IF AZ<0 THEN AZ=AZ+2*PI
270 PRINT: PRINT " DISTANCE (KM)=";FNA(SQR(DE*DE+DN*DN))
280 PRINT: PRINT "BEARING (GRID)=";FNA(AZ/DR)
290 PRINT: PRINT "BEARING (TRUE)=";FNA((AZ+GN)/DR)
300 GOTO 200
1000 E1=VAL(MID$(G$,3,LEN(G$)-5))/10: N1=VAL(RIGHT$(G$,3))/10
1010 T1=ASC(LEFT$(G$,1))-ASC("A"): IF T1>8 THEN T1=T1-1
1020 T2=INT(T1/5): N1=N1+500*(3-T2):E1=E1+500*(T1-5*T2-2)
1030 T1=ASC(MID$(G$,2,1))-ASC("A"): IF T1>8 THEN T1=T1-1
1040 T2=INT(T1/5): N1=N1+100*(4-T2): E1=E1+100*(T1-5*T2)
1050 RETURN